#pragma once

namespace liba {
namespace system {

void lib_assert(const char * _Message, const char *_File, unsigned _Line);
void lib_check(const char * _Message, const char *_File, unsigned _Line);

} // namespace system
} // namespace liba

#ifdef  NDEBUG

#define LIBA_ASSERT(_Expression)    ((void)0)
#define LIBA_FAIL(_Expression)      ((void)0)
#define LIBA_FAIL_UNEXPECTED()		((void)0)

#else

#define LIBA_ASSERT(_Expression) (void)( (!!(_Expression)) || (liba::system::lib_assert(#_Expression, __FILE__, __LINE__), 0) )
#define LIBA_FAIL(_Expression) (void)( liba::system::lib_assert(_Expression, __FILE__, __LINE__) )
#define LIBA_FAIL_UNEXPECTED()		(void)( liba::system::lib_assert("Unexpected failure", __FILE__, __LINE__) )

#endif  /* NDEBUG */

#define LIBA_CHECK(_Expression)		(void)( (!!(_Expression)) || (liba::system::lib_check(#_Expression, __FILE__, __LINE__), 0) )